<%@include file="/header.jsp" %>
<c:url value="/customer/MyAccount" var="myAccountUrl" />


<div id="breadcrump">
    <ul id="breadcrump-list">
        <li>&raquo; <a href="${myAccountUrl}">Mijn account</a> &raquo; Mijn winkelwagen</li>
    </ul>
</div>
    
<c:choose>
    <c:when test="${error != null}">
        FOUT: ${error}
    </c:when>
</c:choose>

<table border="1">
    <tr>
        <th>Aantal</th>
        <th>Productnummer</th>
        <th>Productnaam</th>
        <th>Prijs per stuk</th>
        <th>Totaalprijs</th>
        <th>Hernieuwen</th>
        <th>Verwijderen</th>
    </tr>
    <c:forEach var="orderItem" items="${cartOrder.orderItems}">
        <c:url var="urlRefresh" value="/customer/EditCartItem">
            <c:param name="cartItemId" value="${orderItem.product.id}" />
        </c:url>
        <c:url var="urlDeleteCartItem" value="/customer/DeleteCartItem">
            <c:param name="productId" value="${orderItem.product.id}" />
        </c:url>
        
        <form method="post" action="${urlRefresh}">
        <tr>
            <td><input type="text" name="cartItemQuantity" size="20" value="${fn:escapeXml(orderItem.quantity)}" /></td>
            <td>${orderItem.product.id}</td>
            <td>${orderItem.product.name}</td>
            <td>&euro; ${orderItem.product.price}</td>
            <td>&euro; <fmt:formatNumber value="${orderItem.price}" pattern="#0.00" /></td>
            <td><input type="submit" value="Vernieuwen"></td>
            <td><a href="${urlDeleteCartItem}">Verwijderen</a></td>
        </tr>
        </form>
    </c:forEach>
</table>
<c:choose>
    <c:when test="${cartOrder.orderItems.size() > 0}">
        <c:url var="placeOrderUrl" value="/customer/PlaceOrder" />
        <br><a href="${placeOrderUrl}">Plaats bestelling</a>
    </c:when>
</c:choose>

<%@include file="/footer.jsp" %>
